package com.act.util;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * Created by JavisChen on 2017/4/20.
 */
public class PropertyUtil {

    private static Properties properties = new Properties();

    static {
        loadProperties();
    }

    /**
     * 加载系统配置文件
     */
    private static void loadProperties() {
        try (InputStream in = PropertyUtil.class.getClassLoader().getResourceAsStream("common.properties")) {
            properties.load(in);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    /**
     * 根据获取配置文件对应的值
     * @param key 键
     * @return
     */
    public static String get(String key) {
        return properties.getProperty(key);
    }
}
